<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            width: 500px;
            height: 500px;
            background-color: teal;
        }
        .box2 {
            width: 400px;
            height: 400px;
            background-color: pink;
        }
        .box3 {
            width: 300px;
            height: 300px;
            background-color: #ccfc;
        }
    </style>
</head>
<body>
    <!-- <div id="btn">点击登录</div> -->
    <div class="box1">
        <div class="box2">
            <div class="box3"></div>
        </div>
    </div>
    <input type="text" id="input">
    <select name="" id="select">
        <option value="">123</option>
        <option value="">123</option>
        <option value="">123</option>
    </select>
</body>
<script>
    var btn = document.getElementById('btn');
    var input = document.getElementById('input');
    var select = document.getElementById('select');
    select.onchange = function() {
        confirm(9999)
    }
    document.body.onmousewheel = function() {
        alert(999)
    }
    console.log(input);
    

    
    var div = document.getElementsByTagName('div');

    div[0].onclick = function (e) {
        console.log("box1");
    };
    div[1].onclick = function (e) {
        console.log("box2");
        // e.stopPropagation();
    };
    div[2].onclick = function () {
        console.log("box3");
    };



    // console.log(btn[0]);

    // btn.onclick = function() {
    //     alert('第一次弹出')
    // }
    // btn.onclick = function() {
    //     alert('第二次弹出')
    // }

    // btn.addEventListener('click', function(e) {
    //     alert('first')
    // });
    // btn.addEventListener('click', function(e) {
    //     alert('second')
    // });
    // btn.attachEvent('onclick', function(e) {
    //     alert(999)
    // })

    // function addEvent(element,eventName,callback) {
    //     if(element.addEventListener) {
    //         element.addEventListener(eventName,callback);
    //     }else if(element.attachEvent) {
    //         element.attachEvent('on'+eventName,callback);
    //     }else {
    //         element['on'+eventName] = callback;
    //     }
    // }

    // addEvent(btn,'click',function(){ 
    //     alert(999)
    // })

    // btn["onclick"] = function(e) {
    //     alert(999)
    //     btn.onclick = null
    // }
</script>
</html>